package top.continew.admin.sport.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Service;

import top.continew.admin.sport.model.resp.ProjectEntryResp;
import top.continew.starter.extension.crud.model.query.PageQuery;
import top.continew.starter.extension.crud.model.resp.PageResp;
import top.continew.starter.extension.crud.service.impl.BaseServiceImpl;
import top.continew.admin.sport.mapper.ProjectEntryGradeMapper;
import top.continew.admin.sport.model.entity.ProjectEntryGradeDO;
import top.continew.admin.sport.model.query.ProjectEntryGradeQuery;
import top.continew.admin.sport.model.req.ProjectEntryGradeReq;
import top.continew.admin.sport.model.resp.ProjectEntryGradeDetailResp;
import top.continew.admin.sport.model.resp.ProjectEntryGradeResp;
import top.continew.admin.sport.service.ProjectEntryGradeService;

import java.util.List;

/**
 * 比赛成绩业务实现
 *
 * @author xiahaike
 * @since 2024/09/15 12:52
 */
@Service
@RequiredArgsConstructor
public class ProjectEntryGradeServiceImpl extends BaseServiceImpl<ProjectEntryGradeMapper, ProjectEntryGradeDO, ProjectEntryGradeResp, ProjectEntryGradeDetailResp, ProjectEntryGradeQuery, ProjectEntryGradeReq> implements ProjectEntryGradeService {

    @Resource
    private ProjectEntryGradeMapper projectEntryGradeMapper;

    @Override
    public PageResp<ProjectEntryGradeResp> myPage(ProjectEntryGradeQuery projectEntryGradeQuery, PageQuery pageQuery) {
        QueryWrapper<ProjectEntryGradeResp> queryWrapper = new QueryWrapper<>();
        IPage<ProjectEntryGradeResp> page = projectEntryGradeMapper.myPage(pageQuery.toPage(), queryWrapper, projectEntryGradeQuery.getProjectId());
        return PageResp.build(page);
    }

    @Override
    public List<ProjectEntryResp> noGrade(Long projectId) {
        return projectEntryGradeMapper.noGrade(projectId);
    }


}